Skip to content

[ROCM] Working math function support for ROCm backend, a bug fix in LLVM based codegen#570

Merged
tqchen merged 3 commits intoapache:masterfrom
masahi:rocm-math-func
Oct 20, 2017
Merged

[ROCM] Working math function support for ROCm backend, a bug fix in LLVM based codegen#570
tqchen merged 3 commits intoapache:masterfrom
masahi:rocm-math-func

Conversation

@masahi
Copy link
Copy Markdown
Member

@masahi masahi commented Oct 20, 2017

This PR adds working math function support to ROCm backend. It supersedes #553.
It also fixes a bug in external function call generator in LLVM based codegen.

With this PR, we can pass test_topi_softmax.py and test_topi_reduce.py.
It also enables running resnet and mobilenet benchmark in nnvm.

Resnet18 and mobilenet benchmark, on R9 Nano

$ python cuda_imagenet_bench.py --model resnet
benchmark args: Namespace(model='resnet', num_iter=1000, opt_level=1)
ProfileResult(mean=0.010514197691)
ProfileResult(mean=0.010503243036)
ProfileResult(mean=0.01050078192)
$ python cuda_imagenet_bench.py --model mobilenet
benchmark args: Namespace(model='mobilenet', num_iter=1000, opt_level=1)
ProfileResult(mean=0.005886083819)
ProfileResult(mean=0.005881836798)
ProfileResult(mean=0.005873367036000001)

@masahi
Copy link
Copy Markdown
Member Author

masahi commented Oct 20, 2017

cc @adityaatluri

@masahi masahi changed the title Working math function support for ROCm backend, a bug fix in LLVM based codegen [ROCM] Working math function support for ROCm backend, a bug fix in LLVM based codegen Oct 20, 2017
lint fix

fix build

bug fix extern func call in llvm based codegen
Comment thread src/codegen/llvm/intrin_rule_rocm.cc Outdated
using namespace ir;
const Call* call = e.as<Call>();
CHECK(call != nullptr);
const std::string bit_width = std::to_string(call->type.bits());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be easier to use std::ostringstream to construct the string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specifically use

std::ostringstream intrin_name;

intrin_name << "__ocml_" << call->name << "_f" << call->type.bits();
// use intrin_name.str()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants